@echo off
if "%2" == "" goto :usage
if NOT exist "%1" goto :usage
set INPUT=%1
set OUTPUT=%2

set MODE=NORMAL
if "%3" ==  "reduce" set MODE="REDUCE"

echo -- INPUT  = %INPUT%
asdcp-test -i -H %INPUT% | findstr /C:"ChannelCount ="
echo -- MODE   = %MODE%
asdcp-test -x _TEMP %INPUT%
if "%MODE%" == "NORMAL" xcopy _TEMP_1.wav %OUTPUT%
if "%MODE%" == "REDUCE" wav_6to2 _TEMP_1.wav %OUTPUT%

echo -- OUTPUT = %OUTPUT%
sox %OUTPUT% -n stats
goto :end



:usage
echo -- %0 -- DCPscripts - by Peter Forret --
echo -- Effect: extract WAV file from MXF sound
echo -- Usage:  %0 [INPUT MXF] [OUTPUT WAV] [OPTION]
echo --         [OPTION] = normal - just take output WAV (default)
echo --         [OPTION] = reduce - reduce output to stereo


:end